{$layout}

<div class="ui menu text basic blue small">
	<a href="/settings/mongo" class="item active">连接设置</a>
	<a href="/settings/mongo/data" class="item">数据清理</a>
</div>
<div class="ui divider"></div>

<div>
    <h3>MongoDB连接设置 <a href="/settings/mongo/update" v-if="!teaDemoEnabled">修改</a><a v-if="teaDemoEnabled">[演示版无法修改]</a></h3>

	<p class="ui message warning" v-if="shouldRestart">需要重启TeaWeb服务才能使配置生效。</p>

    <table class="ui table definition selectable">
        <tr>
            <td style="width:11em">主机地址<em>（host）</em></td>
            <td>{{config.host}}</td>
        </tr>
        <tr>
            <td>端口<em>（port）</em></td>
            <td>{{config.port}}</td>
        </tr>
		<tbody v-if="config.authEnabled">
			<tr v-if="config.username.length > 0">
				<td>用户名<em>（username）</em></td>
				<td>{{config.username}}</td>
			</tr>
			<tr v-if="config.password.length > 0">
				<td>密码<em>（password）</em></td>
				<td>{{config.password}}
					<p class="comment" v-if="config.password.length > 0">实际密码已使用星号代替</p>
				</td>
			</tr>
			<tr v-if="config.authMechanism.length > 0">
				<td>认证机制</td>
				<td>{{config.authMechanism}}</td>
			</tr>
			<tr v-if="config.authMechanismProperties.length > 0">
				<td>认证附加参数</td>
				<td>{{config.authMechanismProperties}}</td>
			</tr>
		</tbody>
    </table>

    <h4>组合后连接URI</h4>
    <p class="ui info message uri-box">{{uri}}</p>

    <h4>连接状态</h4>
    <p class="ui info message" v-if="error.length == 0">连接成功</p>
    <p class="ui error message" v-if="error.length > 0">连接失败，需要修复： {{error}}：<a href="/settings/mongo/update">[修改连接设置]</a> &nbsp; <a href="/settings/mongo">[刷新当前页面]</a></p>

    <p class="ui message" v-if="isInstalled && error.length > 0 && !isStarting">我们检测到你已安装MongoDB，<a href="" v-on:click.prevent="startMongo()">[点此尝试启动]</a></p>
    <p class="ui message" v-if="isInstalled && error.length > 0 && isStarting">我们检测到你已安装MongoDB，请耐心等待启动完成 ...</p>

    <h4 v-if="!isInstalled && error.length > 0">我还没有安装MongoDB</h4>
	<p  v-if="!isInstalled && error.length > 0" class="ui message">如果你还没有安装MongoDB，可以 <a href="https://www.mongodb.com/download-center?jmp=nav#community" target="_blank">[去官网下载MongoDB]</a> &nbsp; <span v-if="os != 'windows'">或者 &nbsp; <a href="/settings/mongo/install">[让TeaWeb自动下载并安装MongoDB]</a></span> </p>
</div>